/**
 * @author ZhiWen Ren
 * @version 1.0
 * @description: LeetCode-153-寻找旋转排序数组中的最小值
 * @date 2025/5/26 15:22
 */
public class Solution153 {
    public int findMin(int[] nums) {
        int left = 0;
        int right = nums.length - 1;
        while (left < right) {
            int mid = (left + right) >>> 1;
            if (nums[mid] > nums[right]) {
                left = mid + 1;
            } else {
                right = mid;
            }
        } // left == right,且left的左右两侧均有序
        return nums[0] < nums[left] ? nums[0] : nums[right];
    }
}
